import { _decorator, Component } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('PageBase')
export class PageBase extends Component {

    private _pageIdx: number = -1;

    start() {

    }

    update(deltaTime: number) {

    }

    public executeNotification(name: string, obj: any) {
        // override by child
    }

    public showPage(params?: any): void {
        this.node.active = true;// 显示页面
        console.log(` showPage [${this._pageIdx}]`);
    }

    public hidePage(): void {
        this.node.active = false;// 隐藏页面
        console.log(` hidePage [${this._pageIdx}]`);
    }

    public dispose(): void {
        // override by child
        console.log(`dispose-PageBase`);
    }

    public get pageIdx(): number {
        return this._pageIdx;
    }

    public set pageIdx(val: number) {
        this._pageIdx = val;
    }
}


